import { Router } from 'express';
import { ClientBadgeController } from '../../api/controllers/badgeController';
import { authenticateClient } from '../../middleware/auth';

const router = Router();
const badgeController = new ClientBadgeController();

/**
 * @swagger
 * /api/client/badges/user:
 *   get:
 *     summary: 获取用户徽章
 *     tags: [客户端徽章]
 *     security:
 *       - bearerAuth: []
 *     responses:
 *       200:
 *         description: 获取成功
 *       401:
 *         description: 未授权
 */
router.get('/user', authenticateClient, badgeController.getUserBadges);

/**
 * @swagger
 * /api/client/user/badges:
 *   get:
 *     summary: 获取用户徽章 (兼容路由)
 *     tags: [客户端徽章]
 *     security:
 *       - bearerAuth: []
 *     responses:
 *       200:
 *         description: 获取成功
 *       401:
 *         description: 未授权
 */
router.get('/user/badges', authenticateClient, badgeController.getUserBadges);

/**
 * @swagger
 * /api/client/badges:
 *   get:
 *     summary: 获取所有徽章
 *     tags: [客户端徽章]
 *     parameters:
 *       - in: query
 *         name: page
 *         schema:
 *           type: integer
 *         description: 页码
 *       - in: query
 *         name: pageSize
 *         schema:
 *           type: integer
 *         description: 每页数量
 *     responses:
 *       200:
 *         description: 获取成功
 */
router.get('/', authenticateClient, badgeController.getAllBadges);

export default router;
